import React, { PureComponent } from 'react'
import { Provider } from 'react-redux'
import request from '../../../api/api'
import List from './List/List'
import WaitList from './WaitList/WaitList'
import './Wait.scss'
import store from '../../../redux/store'
export default class Wait extends PureComponent {
  state = {
    waitlist: [],
    list: []
  }
  getWaitList = () => {
    request({
      url:'/api/maoyan/index/mostExpected?ci=1&limit=10&offset=0',
      method:'get'
    }).then(res => {
      this.setState({
        waitlist: res.coming
      })
    })
  }
  getList = () => {
    request({
      url:'/api/maoyan/index/comingList?ci=1&limit=10',
      method:'get'
    }).then(res => {
      this.setState({
        list: res.coming
      })
    })
  }
  componentDidMount() {
    this.getWaitList()
    this.getList()
  }
  render() {
    let { waitlist, list } = this.state
    return (
      <div className='wait'>
        <Provider store={store}>
          <WaitList waitlist={waitlist} />
          <List list={list} />
        </Provider>
      </div>
    )
  }
}
